/**
 * Created by Roc on 2017/6/30.
 */
import { AppRegistry } from 'react-native';
import React, { Component } from 'react';
import App from "./App";
import {connect, Provider} from 'react-redux';
import {getStore} from './redux/store';
import Storage from 'react-native-storage';
import { AsyncStorage } from 'react-native';

var storage = new Storage({
    // 存储引擎：对于RN使用AsyncStorage，对于web使用window.localStorage
    // 如果不指定则数据只会保存在内存中，重启后即丢失
    storageBackend: AsyncStorage,
    // 数据过期时间，默认一整天（1000 * 3600 * 24 毫秒），设为null则永不过期
    defaultExpires: null,
});
export default class RnYouDaiApp extends Component {
    constructor(props){
        super(props);
        global.storage = storage;
        if (!__DEV__) {
            global.console = {
                info: () => {},
                log: () => {},
                warn: () => {},
                debug: () => {},
                error: () => {},
            };
        }
    }
    render() {
        const store = getStore();
        return (
            <Provider store={store}>
                <App />
            </Provider>
        );
    }
};

AppRegistry.registerComponent('RnYouDaiApp', () => RnYouDaiApp);